package com.zmn.plat.services.impl.orderconfig.oderstock.plat;

import java.util.Collections;
import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.zmn.plat.model.entity.orderconfig.orderstock.plat.PlatConfig;
import com.zmn.plat.model.entity.orderconfig.orderstock.plat.PlatConfigQuery;
import com.zmn.plat.persistence.interfaces.orderconfig.orderstock.plat.PlatConfigDao;
import com.zmn.plat.services.interfaces.orderconfig.oderstock.plat.PlatConfigService;

import lombok.extern.slf4j.Slf4j;

/**
 * 描述: 平台配置基础接口实现类
 *
 * @author tanghongjun
 * @since 2020-03-17 11:23:43
 **/
@Slf4j
@Service
public class PlatConfigServiceImpl implements PlatConfigService {

    private static final String TAG = "平台配置基础服务接口";

    @Resource
    private PlatConfigDao platConfigDao;

    @Override
    public PlatConfig findByKey(Integer id) {
        return platConfigDao.findByKey(id);
    }

    @Override
    public List<PlatConfig> listPageByQuery(PlatConfigQuery query) {
        Integer count = countByQuery(query);
        query.setTotalCount(count);
        return count == 0 ? Collections.emptyList() : platConfigDao.listPageByQuery(query);
    }

    @Override
    public List<PlatConfig> listByQuery(PlatConfigQuery query) {
        return platConfigDao.listByQuery(query);
    }

    @Override
    public Integer countByQuery(PlatConfigQuery query) {
        return platConfigDao.countByQuery(query);
    }

    @Override
    public Integer updateByKey(PlatConfig platConfig) {
        return platConfigDao.updateByKey(platConfig);
    }

    @Override
    public int updateStatusByIds(List<Integer> ids, Integer status, String updater) {
        return platConfigDao.updateStatusByIds(ids, status, updater);
    }

    @Override
    public Integer insert(PlatConfig platConfig) {
        return platConfigDao.insert(platConfig);
    }

    @Override
    public Integer insertBatch(List<PlatConfig> list) {
        return platConfigDao.insertBatch(list);
    }

    @Override
    public Integer deleteByKey(Integer id) {
        return platConfigDao.deleteByKey(id);
    }
}